package tunafish2k.rpgex.renderers;

import net.minecraft.client.model.Dilation;
import net.minecraft.client.model.ModelData;
import net.minecraft.client.model.ModelPart;
import net.minecraft.client.model.ModelPartBuilder;
import net.minecraft.client.model.ModelPartData;
import net.minecraft.client.model.ModelTransform;
import net.minecraft.client.model.TexturedModelData;
import net.minecraft.client.render.RenderLayer;
import net.minecraft.client.render.VertexConsumer;
import net.minecraft.client.render.entity.model.EntityModel;
import net.minecraft.client.util.math.MatrixStack;
import tunafish2k.rpgex.entities.StoneDartProjectile;

public class StoneDartProjectileModel extends EntityModel<StoneDartProjectile> {
    private final ModelPart main;

    public StoneDartProjectileModel(ModelPart root) {
        super(RenderLayer::getEntitySolid);
        this.main = root.getChild("main");
    }

    public static TexturedModelData getTexturedModelData() {
		ModelData modelData = new ModelData();
		ModelPartData modelPartData = modelData.getRoot();
		ModelPartData bb_main = modelPartData.addChild("main", ModelPartBuilder.create().uv(2, 1).cuboid(0.0F, -14.0F, -1.0F, 1.0F, 14.0F, 1.0F, new Dilation(0.0F))
		.uv(2, 1).cuboid(-1.0F, -8.0F, -1.0F, 1.0F, 8.0F, 1.0F, new Dilation(0.0F))
		.uv(2, 1).cuboid(0.0F, -8.0F, 0.0F, 1.0F, 8.0F, 1.0F, new Dilation(0.0F))
		.uv(2, 1).cuboid(1.0F, -8.0F, -1.0F, 1.0F, 8.0F, 1.0F, new Dilation(0.0F))
		.uv(4, 3).cuboid(0.0F, -8.0F, -2.0F, 1.0F, 8.0F, 1.0F, new Dilation(0.0F)), ModelTransform.pivot(0.0F, 7.0F, 0.0F));
		return TexturedModelData.of(modelData, 32, 32);
    }

    @Override
    public void setAngles(StoneDartProjectile entity, float limbSwing, float limbSwingAmount, float ageInTicks,
            float netHeadYaw, float headPitch) {
    }

    @Override
    public void render(MatrixStack matrices, VertexConsumer vertices, int light, int overlay, int color) {

        main.render(matrices, vertices, light, overlay, color);
    }

    public ModelPart getMain() {
        return main;
    }
}